home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / misc / loadpole / coils.bas next >
BASIC Source File  |  1992-02-19  |  3KB  |  49 lines

  1. 100 'program to calculate the number of turns for an inductor.
  2. 110 cls:pi=3.1415926545
  3. 120 k=1473061.855               'mhos per square inch of area of copper
  4. 130 print "                      +----------------------------+"
  5. 140 print "                      | Inductor Design Calculator |"
  6. 150 print "                      | by David E. Powell, KA4KNG |"
  7. 160 print "                      +----------------------------+":print:print
  8. 210 input "Desired inductance in microhenries";L
  9. 220 input "Gauge or diameter of wire in inches";diameter
  10. 230 input "Diameter of coil form in inches";form
  11. 240 if diameter >= 1 then diameter = .46 / 1.1229283027^(diameter +3)
  12. 250 print:print "calculating";
  13. 260 layers=1                    'Single layer starting out
  14. 500 a=diameter*layers+form      'Average coil diameter to center of thickness
  15. 505 print ".";
  16. 510 gosub 2000                  'calculate the number of turns
  17. 520 if prob =1 then layers = layers+1:if layers < 100 then goto 500
  18. 530 if b > 1 then layers=layers+1:goto 500
  19. 540 if n > 9999 then print "ERROR - turns count larger than 10000":system
  20. 550 n=cint(n):b=n*diameter/layers:ltry = (0.2 * a^2 * n^2)/(3*a+9*b+10*c)
  21. 560 w.length = n*a*pi
  22. 570 'calculate the resistance of coil
  23. 580 w.area = (diameter/2)^2*pi
  24. 590 r = 1/(w.area*k)*w.length
  25. 800 'show the results
  26. 810 print:print
  27. 815 print "Overall coil diameter......  ";diameter*layers*2+form;"inches"
  28. 820 print "Average coil diameter......  ";a;"inches"
  29. 830 print "Depth of coil..............  ";layers*diameter;"inches"
  30. 840 print "Length of coil.............  ";b;"inches"
  31. 850 print "Length of wire (approx)....  ";int(w.length/12)"feet,";
  32. 855 print int((w.length-int(w.length))*12);"inches"
  33. 860 print "Number of layers...........  ";layers
  34. 870 print "Number of turns............  ";n
  35. 880 print "Number of turns per layer..  ";n/layers
  36. 890 print "Actual inductance..........  ";ltry;"microhenries"
  37. 900 print "Coil DC resistance.........  ";r;"ohms"
  38. 1000 system             'Exit the program and BASIC
  39. 2000 'subroutine to calculate the number of turns
  40. 2010 min.n=1:max.n=10000:c=layers * diameter:prob=0
  41. 2060     n=(max.n-min.n)/2+min.n
  42. 2070     b=n*diameter/layers     'length of coil
  43. 2080     ltry = (0.2 * a^2 * n^2)/(3*a+9*b+10*c)
  44. 2090     if cint(max.n) = cint(min.n) then goto 3000
  45. 2100     if min.n => 9999 then prob=1:goto 3000
  46. 2110     if ltry < L then min.n=n:goto 2060
  47. 2120     if ltry > L then max.n=n:goto 2060
  48. 3000     return
  49.